package datasv.collegeQuery_datasv;

import java.util.ArrayList;
import java.util.List;

import data.datafactory.DatabaseOperator;

public class GetCouOfCollege {
	public static void main(String[] args) {
		System.out.println(new GetCouOfCollege().getCouOfCollege("001"));
	}
	public List<String> getCouOfCollege(String collegeID){
		return getInSql(collegeID);
	}
	private List<String> getInSql(String collegeID){
		DatabaseOperator op=new DatabaseOperator("college");
		ArrayList<String> list=new ArrayList<String>();
		if(!op.ifIDExist("college_list", collegeID)){
			return list;
		}
		ArrayList<String> idList=op.getColumn("course_list", "id");
		for (int i = 0; i < idList.size(); i++) {
			if(idList.get(i).substring(0, 3).equals(collegeID)){
				list.add(idList.get(i));
			}
		}
		return list;
	}
}
